package utils.timer;

enum TimerState
{
	START,
	STOP
}

public class Timer {
	private long init;
	private long end;
	
	private TimerState state;
	
	public Timer()
	{
		state = TimerState.STOP;
	}
	
	public void start()
	{
		state = TimerState.START;
		init = System.currentTimeMillis();
	}
	
	public void stop()
	{
		if(state == TimerState.STOP) return;
		
		end = System.currentTimeMillis();
		state = TimerState.STOP;
	}
	
	public long timeElapsed()
	{
		return end - init;
	}
}
